package logic

import (
	"context"
	"huiyun/model/mysql"

	"huiyun/huiyunrpc/huiyunrpc"
	"huiyun/huiyunrpc/internal/svc"

	"github.com/zeromicro/go-zero/core/logx"
)

type SportShowLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewSportShowLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SportShowLogic {
	return &SportShowLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// 活动详情
func (l *SportShowLogic) SportShow(in *huiyunrpc.SportShowRequest) (*huiyunrpc.SportShowResponse, error) {
	// todo: add your logic here and delete this line
	var sport mysql.Sport
	mysql.DB.Debug().Where("id=?", in.SportId).Find(&sport)
	return &huiyunrpc.SportShowResponse{
		Image:     sport.Image,
		Name:      sport.Name,
		ClassName: sport.ClassName,
		Writer:    sport.Writer,
		Num:       sport.Num,
		UserId:    sport.UserId,
	}, nil
}
